package com.example.framework.utils;

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.view.View;
import android.view.animation.LinearInterpolator;

/**
 * @author:0.2℃
 * @date： 2022-03-31 01:26
 * @Description ：动画工具类
 */
public class AnimUtils {

    /**
     * 旋转动画
     * @param obj
     * @return
     */
    public static ObjectAnimator rotation(View obj) {
        // 音乐小图标旋转
        ObjectAnimator mAnim = ObjectAnimator.ofFloat(obj, "rotation", 0f, 360f);
        mAnim.setDuration(2 * 1000);
        // 循环播放
        mAnim.setRepeatMode(ValueAnimator.RESTART);
        // 一直播放
        mAnim.setRepeatCount(ValueAnimator.INFINITE);
        // 差时器
        mAnim.setInterpolator(new LinearInterpolator());

        return mAnim;
    }
}
